package cn.swust.designpatternlearningplatform.dao;

import cn.swust.designpatternlearningplatform.dao.sql.PaperResultDaoSql;
import cn.swust.designpatternlearningplatform.dao.sql.StudentTestDaoSql;
import cn.swust.designpatternlearningplatform.domain.entity.PaperResult;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

@Mapper
public interface PaperResultDao {
    /**
     * @param studentNumber:
    	 * @param paperNumber:
      * @return List<PaperResult>
     * @author wang
     * description 通过学号以及试卷号查找试卷的作答情况
     * date 2023/5/19 13:43
     */
    @SelectProvider(type = PaperResultDaoSql.class,method = "getPaperResult")
    List<PaperResult> getPaperResult(String studentNumber, String paperNumber);
    /**
     * @param paperResult1:
      * @return void
     * @author wang
     * description  将做题答案插入数据库
     * date 2023/5/19 13:46
     */
    @InsertProvider(type = PaperResultDaoSql.class,method = "insertPaperResult")
    void insertPaperResult(PaperResult paperResult1);
    /**
     * @param testId:
      * @return List<PaperResult>
     * @author wang
     * description 查询该试卷下的所有学生的成绩
     * date 2023/5/19 17:11
     */
    @Results(value = {
            @Result(property = "id",column = "id"),
            @Result(property = "studentNumber",column = "student_number"),
            @Result(property = "paperNumber",column = "paper_number"),
            @Result(property = "topicId",column = "topic_id"),
            @Result(property = "ownAnswer",column = "own_answer"),
            @Result(property = "isRight",column = "is_right"),
    })
    @SelectProvider(type = PaperResultDaoSql.class,method = "getPaperResultByTestId")
    List<PaperResult> getPaperResultByTestId(String testId);
     @DeleteProvider(type = PaperResultDaoSql.class,method = "deleteResult")
    void deleteResult(String testId);
    @SelectProvider(type = PaperResultDaoSql.class,method = "getStudentNumber")
    Set<String> getStudentNumber(String testId);
    @SelectProvider(type = PaperResultDaoSql.class,method = "getTopicId")
    List<Integer> getTopicId(String testId, String studentNumber);
}
